<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="app.engine.solucoes.request.beans.*" errorPage="error.jsp"%>
	<jsp:useBean id="usuario" class="app.engine.solucoes.request.beans.Usuario" scope="session" />
<html>
<head>
	<script type="text/javascript" src="/javascript/script.js"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title><%=usuario.getNomeUsuario() != null ? usuario.getNomeUsuario() : ""%> - [Menu Principal]</title>
</head>
<script language="JavaScript">
	function setCmd(value) {
		document.menu.cmd.value = value;
	}
</script>
<body>
<%
	if (usuario.getId() == null) {
		response.sendRedirect("/");
	}
%>
<form name="menu" action="faqtool" method="post">
	<input type="hidden" name="cmd" value="">
	<table border="1" align="center">
		<tr>
			<td>
			<table bgcolor="tan" border="0" align="center" cellpadding="10"
				cellspacing="0">
				<tr>
					<th>Administraçao de FAQs: Menu Principal</th>
				</tr>
				<%  if(!usuario.getLogin().equals("administrador")) { %> 
					<tr>
						<td align="center">
							<input type="submit" value="Pesquisar FAQ" onClick="setCmd('list-faq')">
						</td>
					</tr>
				
					<tr>
						<td align="center">
							<input type="submit" value="Criar FAQ" onClick="setCmd('add')">
						</td>
					</tr>
				<% } %>
				<%  if(usuario.getEhModerador()) { %>
					<%  if(!usuario.getLogin().equals("administrador")) { %>
						<tr>
							<td align="center">
								<input type="submit" value="Atualizar FAQ" onClick="setCmd('update-menu')">
							</td>
						</tr>
					<% } %>
					<tr>
						<td align="center">
							<input type="submit" value="<%=usuario.getLogin().equals("administrador") ? "Cadastrar Empresa" : "Cadastrar Usuário" %>" onClick="setCmd('add-user')" size="300px">
						</td>
					</tr>
					<tr>
						<td align="center">
							<input type="submit" value="<%=usuario.getLogin().equals("administrador") ? "Manutenção de Empresa" : "Manutenção de Usuário" %>" onClick="setCmd('all-user')" size="300px">
						</td>
					</tr>
				<% } %>
				<tr>
					<td align="center">
						<input type="submit" value="Sair" onClick="setCmd('exit')">
					</td>
				</tr>
				<% if (request.getAttribute("faqtool.msg") != null) { %>
					<tr>
						<td colspan="2" bgcolor="white">
							<font size="-1" color="<%=request.getAttribute("corFonte") != null ? request.getAttribute("corFonte") : "black"%>"> 
								<i><%=request.getAttribute("faqtool.msg")%></i>
							</font>
						</td>
					</tr>
				<%} %>
			</table>
			</td>
		</tr>
	</table>
</form>
</body>
</html>